﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ValidateTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void _ctlBtnValidatePhone_Click(object sender, EventArgs e)
        {
            if (!System.Text.RegularExpressions.Regex.IsMatch(_ctlEditInput.Text, @"^1[3578]\d{9}$"))
            {
                MessageBox.Show("失败");
                return;
            }
            MessageBox.Show("成功");
        }

        private void _ctlBtnValidatePassword_Click(object sender, EventArgs e)
        {
            //^[a-zA-Z]\w{5,17}$
            if (!System.Text.RegularExpressions.Regex.IsMatch(_ctlEditInput.Text, @"^[^\s\u4e00-\u9fa5]{6,18}$"))
            {
                MessageBox.Show("失败,正确格式为：长度在6~18之间,不能含有空格和汉字。");
                return;
            }
            MessageBox.Show("成功,正确格式为：长度在6~18之间，,不能含有空格和汉字。");
        }
    }
}
